package exceptionExample;
import java.util.Scanner;

public class TryCatchDemo {
    public static void main(String[] args) {
        int a,b,c;
        try
        {
            Scanner in = new Scanner(System.in);
            a = 100;
            b = in.nextInt();
            c = a/b;
            System.out.println("c = "+c);
            System.out.println("没有异常！");
        }
        catch(ArithmeticException e)
        {
            System.out.println("捕获异常: "+e.getMessage());
            e.printStackTrace();
        }
        catch(Exception e)
        {
            System.out.println("没有异常处理类: "+e.getMessage());
            e.printStackTrace();
        }
        finally
        {
            System.out.println("执行完毕！");
        }
    }
}
